package com.auto.signup.weixin.model;

import java.util.Map;
import java.util.Objects;

/**
 * 网页授权 通过code 获取到的实体
 * 
 * @author randyjie
 *
 */
public class WebAuthTokenModel{

	/**
	 * 
	 */
	private String accessToken;// access_token
								// 网页授权接口调用凭证,注意：此access_token与基础支持的access_token不同
	private Long expiresIn;// expires_in access_token接口调用凭证超时时间，单位（秒）
	private String refreshToken;// refresh_token 用户刷新access_token
	private String openid;// openid
							// 用户唯一标识，请注意，在未关注公众号时，用户访问公众号的网页，也会产生一个用户和公众号唯一的OpenID
	private String scope;// scope 用户授权的作用域，使用逗号（,）分隔
	private String unionid;// unionid

	public WebAuthTokenModel() {
		super();
	}

	public WebAuthTokenModel(Map<String, Object> map) {
		this.accessToken = Objects.toString(map.get("access_token"), null);
		this.expiresIn = Long.valueOf(Objects.toString(map.get("expires_in"), "0"));
		this.refreshToken = Objects.toString(map.get("refresh_token"), null);
		this.openid = Objects.toString(map.get("openid"), null);
		this.scope = Objects.toString(map.get("scope"), null);
		this.unionid = Objects.toString(map.get("unionid"), null);
	}

	public WebAuthTokenModel(String access_token, Long expires_in, String refresh_token, String openid, String scope,
			String unionid) {
		super();
		this.accessToken = access_token;
		this.expiresIn = expires_in;
		this.refreshToken = refresh_token;
		this.openid = openid;
		this.scope = scope;
		this.unionid = unionid;
	}

	public String getAccessToken() {
		return accessToken;
	}

	public void setAccessToken(String accessToken) {
		this.accessToken = accessToken;
	}

	public Long getExpiresIn() {
		return expiresIn;
	}

	public void setExpiresIn(Long expiresIn) {
		this.expiresIn = expiresIn;
	}

	public String getRefreshToken() {
		return refreshToken;
	}

	public void setRefreshToken(String refreshToken) {
		this.refreshToken = refreshToken;
	}

	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	public String getScope() {
		return scope;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}

	public String getUnionid() {
		return unionid;
	}

	public void setUnionid(String unionid) {
		this.unionid = unionid;
	}

}
